<template>
	<div style="background-color: #f4fafe;">
		<div class="main">
			<div  @click="$router.push('/work')"><i class="el-icon-arrow-left" ></i>返回</div>
			<div style="font-size: 1.25rem;font-weight: 18.75;">教学资料库</div>
			<div style="background-color:#b0b0b0;height: 3.25rem;width: 3.25rem;">完成</div>
		</div>
		<div style="margin-left: 10%;margin-right: 10%;">
			<div class="btn_group">
				<div class="header1">
					<div style="height: 36px;line-height: 2.25rem;">我的课程({{CourseByTeacherList.length}})</div>

				</div>
				<!-- 搜索框 -->
				<!-- <div class="dataSearch"> -->
					<!-- 输入框 -->
					<!-- <input type="text" class="ipt_val" placeholder="搜索" v-model="formData.search" /> -->
					<!-- 放大镜 -->
				<!-- 	<input type="button" class="ipt_fdj" @click="getFiles" /> -->
					<!-- 搜索按钮 -->
				<!-- 	<button type="button" class="ipt_search" @click="getFiles">搜索</button> -->
				<!-- </div> -->
			</div>

			<div>
				<el-row :gutter="20" style="margin-top: 1.875rem;overflow: hidden;height: 100vh;">
					<el-col :span="6" v-for="Item in CourseByTeacherList" :key="Item.id" style="margin-bottom: 3.25rem;">
						<div class="grid-content" @click="mycourse(Item.id)">
							<div class="live-course-thumb">
								<img :src="Item.courseImg" />
							</div>
							<div class="live-course-body">
								<div class="live-course-title">{{Item.courseName}}</div>
								<div class="live-course-info">黄伟</div>
							</div>
						</div>
					</el-col>
				</el-row>
			</div>
		</div>
	</div>
</template>

<script>
	import {
		HttpManager
	} from "../../../../request/Teacher.js"
	export default {
		data() {
			return {
				// 表单数据
				formData: {
					// 上级文件夹id，默认全部文件最上层为0
					id: 0,
					// 搜索框内容
					search: '',
					// 是否逆序
					reverse: false
				},
				CourseByTeacherList: ''
			}
		},
		methods: {
			// 获取文件列表
			async getFiles() {
				// 清空被选中文件id列表
				this.checkedList = []
				console.log('获取文件列表')
				// params参数：文件夹id、搜索的值、是否逆序
				// this.files = await axios.get('/files', { params: this.formData })
			},
			//路由跳转
			mycourse(id) {
				this.$router.push({
					path: '/mycourse',
					query: {
						userId: id
					}
				});
			},
			//获取课程列表
			getCourseByTeacher() {
				HttpManager.getCourseByTeacher().then(e => {
					this.CourseByTeacherList = e.data.data;
				})
			},


		},
		created() {
			this.getCourseByTeacher();
		},
	}
</script>

<style scoped="scoped" lang="scss">
	.main {
		width: 100%;
		height: 3.25rem;
		line-height: 3.25rem;
		display: flex;
		justify-content: space-between;
		color: white;
		text-align: center;
		cursor: pointer;
		background-color: #03d3bd;
		overflow: hidden;

	}

	.main>div {

		margin-left: 20px;
		margin-right: 1.25rem;
	}

	// 顶部按钮组
	.btn_group {
		display: flex;
		justify-content: space-between;
		margin-top: 1.25rem;
		margin-bottom: 20px;
		margin-left: 0.625rem;


		// 搜索框
		.dataSearch {
			position: relative;
			width: 300px;
			height: 36px;

			// 输入框
			.ipt_val {
				position: absolute;
				left: 0;
				top: 0;
				padding: 0 14px 0 28px;
				outline: none;
				border-color: #d5d7d9;
				width: 170px;
				height: 34px;
				font-size: 14px;
				color: #181e33;
				border: 1px solid #e5e5e5;
				background: #f5f6f7;
				border-radius: 40px;
			}

			// 放大镜
			.ipt_fdj {
				position: absolute;
				// right: 14px;
				left: 8px;
				top: 8px;
				border: none;
				width: 18px;
				height: 18px;
				background-color: pink;
				background: url(/images/search_ico_new.png);
				background-size: 18px;

				&:hover {
					cursor: pointer;
					background-position: 0 -22px;
					border: #00DBCF;
				}
			}

			// 搜索按钮
			.ipt_search {
				// width: 40px;
				position: absolute;
				right: 0;
				top: 0;
				padding: 0 22px;
				border: none;
				height: 36px;
				border-radius: 17px;
				background-color: #c8c8c8;
				color: #fff;

				&:hover {
					cursor: pointer;
					color: #ffffff;
				}
			}
		}
	}

	.grid-content {
		height: 11.25rem;
		width: 100%;
		margin-bottom: 3.25rem;
		margin-left: 0.625rem;
		background-color: #f7fafc;

	}

	grid-content {
		width: 98%;
		height: 273px;
		display: flex;
		cursor: pointer;
		flex-direction: column;
		// border-radius: 8px;
		margin-left: 1%;
		margin-right: 1%;
		margin-top: 1.25rem;
	}

	.live-course-thumb img {
		width: 100%;
		height: 100%;
		// border-radius: 8px 8px 0 0;
		transition: all .5s;
	}

	.live-course-thumb {
		width: 100%;
		height: 198px;
		overflow: hidden;
	}

	.live-course-body {
		box-sizing: border-box;
		width: 100%;
		height: 75px;
		background-color: #fff;
		border-radius: 0 0 8px 8px;
		padding: 15px 15px 15px 10px;
	}

	.live-course-title {
		width: 100%;
		height: 16px;
		float: left;
		font-size: 16px;
		font-weight: 600;
		color: #151515;
		line-height: 16px;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
		margin-bottom: 9px;
	}

	.live-course-info {
		width: 100%;
		height: 20px;
		float: left;
		display: flex;
		align-items: center;
		color: #cfcfcf;
	}

	.course-add .el-form.base-form .course-cover-uploader,
	.course-add .el-form.exercise-form .course-cover-uploader {
		width: 400px;
		height: 120px;
		border-radius: 4px;
		background-image: url(https://s6.kaoshixing.com/static/vue/images/base/course-icon-picture.png?v=a69cd2a664);
		background-repeat: no-repeat;
		background-size: cover;
	}
</style>
